/*********************************************************************
 * 						computer graphics
 * 							exercise 4
 * 					shaham fridenberg 039421268
 *                    danielle barda 304954654
 ********************************************************************/

import javax.media.opengl.GL;
import javax.media.opengl.glu.GLU;
import javax.media.opengl.glu.GLUquadric;

import com.sun.opengl.util.texture.Texture;


public class Cone {
	
	float x, y, z;
	float radius;
	Texture tex;
	
	// c'tor
	public Cone(float x, float y, float z, float radius, Texture tex)
	{
		this.x = x;
		this.y = y;
		this.z = z;
		this.radius = radius;
		this.tex = tex;
	}
	
	public int draw(GL gl, GLU glu){
		int list = gl.glGenLists(1);
		gl.glNewList(list, GL.GL_COMPILE);
		gl.glTranslatef(x,y,z);
		GLUquadric quadric=glu.gluNewQuadric();
		gl.glEnable(GL.GL_TEXTURE_2D);
		glu.gluQuadricNormals(quadric, GL.GL_TRUE);
		glu.gluQuadricDrawStyle(quadric, GLU.GLU_FILL);
		glu.gluQuadricTexture(quadric,true);
		tex.bind();
		glu.gluCylinder(quadric, 135, 0, 300, 20, 20);
		//glu.gluSphere(quadric, radius, 200, 200);
		gl.glEndList();
		return list;
	}
}
